var a = getApp();

Page({
    data: {
        page: 1
    },
    onLoad: function(a) {
        this.getData();
    },
    gotoVolume_detail: function(a) {
        console.log(a.currentTarget.dataset.id);
        var e = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageC/entry_orders/volume_detail/volume_detail?id=" + e
        });
    },
    gotoCoupon_exchange: function() {
        wx.navigateTo({
            url: "/packageC/entry_orders/coupon_exchange/coupon_exchange"
        });
    },
    goMeetingIndex: function(a) {
        console.log("去获得记录"), wx.navigateTo({
            url: "/packageC/entry_orders/coupon_exrecord/coupon_exrecord"
        });
    },
    streetClose: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        console.log(this.data.current_page), console.log(this.data.last_page), this.data.current_page < this.data.last_page ? (wx.showLoading({
            title: "加载中",
            mask: !0
        }), this.setData({
            page: this.data.page + 1
        }), this.getNext(this.data.selected)) : wx.showToast({
            title: "没有更多",
            icon: "none"
        });
    },
    onShareAppMessage: function() {},
    getData: function() {
        var e = this, t = a.getNetAddresss("plugin.pending-order.frontend.member-wholesale.index");
        a._getNetWork({
            url: t,
            data: {
                page: this.data.page
            },
            success: function(a) {
                var t = a.data;
                console.log(t.data), e.setData({
                    info: t.data.data,
                    current_page: t.data.current_page,
                    last_page: t.data.last_page
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getNext: function() {
        var e = this, t = a.getNetAddresss("plugin.pending-order.frontend.member-wholesale.index");
        a._getNetWork({
            url: t,
            data: {
                page: this.data.page
            },
            success: function(a) {
                var t = a.data;
                if (1 == t.result) {
                    if (console.log(t), t.data.current_page > t.data.last_page) return wx.hideLoading(), 
                    wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void e.setData({
                        current_page: t.data.current_page,
                        last_page: t.data.last_page
                    });
                    wx.hideLoading(), e.setData({
                        info: e.data.info.concat(t.data.data),
                        current_page: t.data.current_page,
                        last_page: t.data.last_page
                    });
                } else console.log("请求失败");
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});